home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual Foxpro 6.0 (Ent. Edition) / Vf6ent Extractor.EXE / TOOLS / XSOURCE / XSOURCE.ZIP / vfpsource / wizards / Wzcommon / regsamps.prg < prev    next >
Encoding:
Text File  |  1998-05-01  |  1.8 KB  |  76 lines

  1. #DEFINE ERROR_SUCCESS 0 
  2.  
  3. ************* Registry Samples *********************
  4.  
  5. SET PROCEDURE TO registry ADDITIVE
  6.  
  7. oReg=create('registry')
  8. LOCAL cExtn,cAppKey,cAppName,nErrNum
  9. LOCAL cOptionValue,cOptionName,aFoxOptions
  10.  
  11.  
  12. **** Sample A
  13. * This sample shows how to check the location of an application
  14. * such as Word or Excel by looking up an associated extension 
  15. * (e.g., DOC,OLE) in the Registry.
  16.  
  17. cExtn = "xls"
  18. cAppKey = ""
  19. cAppName = ""
  20.  
  21. * Get Application
  22. nErrNum = oReg.GetAppPath(m.cExtn,@cAppKey,@cAppName)
  23. IF m.nErrNum # ERROR_SUCCESS
  24.     RETURN
  25. ENDIF
  26.  
  27.  
  28. *-- Misc things to check for:
  29.  
  30. * Remove switch here (e.g., C:\EXCEL\EXCEL.EXE /e)
  31. IF AT(" ",m.cAppName) #0
  32.     m.cAppName= ALLTRIM(SUBSTR(m.cAppName,1,AT(" ",m.cAppName)))
  33. ENDIF
  34.  
  35. ? m.cAppKey
  36. ? m.cAppName
  37.  
  38. * Is this the right version of application?
  39. ? "Version: "+RIGHT(m.cAppKey,1)  && check for valid version
  40.  
  41. * Does file exist?
  42. ? "File exists: "+IIF(FILE(m.cAppName),"Yes","No")
  43. ?
  44.  
  45. **** Sample B
  46. * This sample shows how to lookup a Visual FoxPro option
  47. * that is saved to the Registry via the Options dialog.
  48.  
  49. cOptionValue = ""
  50. cOptionName = "ResWidth"
  51. m.nErrNum = oReg.GetFoxOption(m.cOptionName,@cOptionValue)  
  52. ? m.cOptionName+" :"+m.cOptionValue
  53.  
  54. cOptionName = "ResHeight"
  55. cOptionValue = ""
  56. m.nErrNum = oReg.GetFoxOption(m.cOptionName,@cOptionValue)  
  57. ? m.cOptionName+" :"+m.cOptionValue
  58.  
  59. **** Sample C
  60. * This sample sets a Fox Option
  61.  
  62. cOptionName = "ResWidth"
  63. cOptionValue = "640"
  64. m.nErrNum = oReg.SetFoxOption(m.cOptionName,m.cOptionValue)  
  65. cOptionName = "ResHeight"
  66. cOptionValue = "480"
  67. m.nErrNum = oReg.SetFoxOption(m.cOptionName,m.cOptionValue)  
  68. ?
  69. WAIT WINDOW
  70.  
  71. **** Sample D
  72. * This sample enumerates throught Options key to populates array
  73. DIMENSION aFoxOptions[1,2]
  74. m.nErrNum = oReg.EnumFoxOptions(@aFoxOptions)  
  75. LIST MEMO LIKE aFoxOptions
  76.